<template>
  <div class="analyse-container">
    <div class="analyse-page-list analyse-fast-list">
      <el-collapse v-model="activeCollapse" accordion>
        <el-collapse-item v-for="item in analyseList" :key="item.id" :name="item.id">
          <div slot="title" class="group-title">
            <i
              class="icon-toggle"
              :class="activeCollapse === item.id ? 'el-icon-caret-bottom' : 'el-icon-caret-right'"
            ></i>
            <el-tooltip effect="dark" :content="item.name" placement="top-start">
              <span class="name">{{ item.name }}</span>
            </el-tooltip>
            <el-popover placement="right-start" width="120" trigger="hover" popper-class="tag-group-handler">
              <ul>
                <li @click="$router.push({ name: 'analyse-funnel' })">
                  <i class="el-icon-circle-plus-outline"></i>新建分析
                </li>
              </ul>
              <i class="el-icon-more group-handler" slot="reference"></i>
            </el-popover>
          </div>
          <!-- <difference-list
            ref="differenceList"
            v-if="item.id === 'difference'"
            @updateContent="updateContent"
          ></difference-list> -->
        </el-collapse-item>
      </el-collapse>
    </div>
    <!-- <difference-content
      ref="differenceContent"
      :config="selectItem"
      v-if="activeCollapse === 'difference'"
    ></difference-content> -->
  </div>
</template>

<script>
// import differenceList from './difference/difference-list'
// import differenceContent from './difference/difference-content'
export default {
  components: {
    // differenceList,
    // differenceContent
  },
  data() {
    return {
      activeCollapse: '',
      analyseList: [{ id: 'difference', name: '画像差异化分析', icon: 'iconDifference' }],
      selectItem: {}
    }
  },
  watch: {
    activeCollapse(val) {
      this.$refs[val + 'List'][0].getList()
    }
  },
  methods: {
    getResults() {
      if (!this.activeCollapse) this.activeCollapse = 'difference'
    },
    updateContent(item) {
      this.selectItem = item
    }
  }
}
</script>

<style lang="scss">
.analyse-fast-list {
  .el-collapse-item__header {
    font-size: 16px;
    height: 45px;
    padding: 0 10px;
    line-height: 45px;
    &:hover {
      background-color: #efefef;
    }
  }
  .el-collapse-item__arrow {
    display: none;
  }
  .icon-toggle {
    font-size: 18px;
    color: #4d82e9;
  }
  .el-collapse-item__content {
    padding-bottom: 0;
  }
  .no-record {
    text-align: center;
  }
  .analyse-list {
    padding: 0 25px;
    .list-item {
      padding: 5px;
    }
  }
  .group-title {
    width: 100%;
    position: relative;
    padding-right: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    .name {
      margin-left: 10px;
    }
  }
  .group-handler {
    color: #4d82e9;
    position: absolute;
    top: 15px;
    right: 0;
  }
}
</style>
